package com.boang.thread;

import java.util.concurrent.ArrayBlockingQueue;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;

/*
    @author:sa
    @date:2024/11/27 13:52
*/
public class ExccutorDemo {
    public static void main(String[] args) {
        ThreadPoolExecutor executor = new ThreadPoolExecutor(10, 15, 30,
                TimeUnit.MINUTES, new ArrayBlockingQueue<>(5),new ThreadPoolExecutor.DiscardOldestPolicy());
        for (int i = 0; i < 25; i++) {
            executor.submit(new Runnable() {
                @Override
                public void run() {
                    System.out.println(Thread.currentThread().getName());
                }
            });
        }
    }
}
